home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- #include <stdio.h>
-
- #include <Xm/Xm.h>
- #include <Xm/Frame.h>
- #include <X11/Intrinsic.h>
- #include <X11/extensions/SGIStereo.h>
-
- #include <GL/gl.h>
- #include <GL/glu.h>
- #include <GL/glx.h>
- #include <GL/GLwMDrawA.h>
-
- #define Color_Buffer_Size 1
- #define Depth_Buffer_Size 1
-
- void initCB(Widget, XtPointer, XtPointer),
- exposeCB(Widget, XtPointer, XtPointer),
- resizeCB(Widget, XtPointer, XtPointer);
-
- main(int argc, char **argv)
- {
- XtAppContext application_context;
- Widget toplevel, glw;
- Arg args[10];
- int n = 0;
- GLXContext glw_context;
- String fallback[] = {
- "*frame*shadowType: SHADOW_IN",
- "*boiler*width: 400",
- "*boiler*height: 400",
- NULL
- };
-
- toplevel = XtAppInitialize(&application_context, "BoilerPlate",
- (XrmOptionDescList) NULL, 0,
- &argc, (String *)argv,
- fallback, (ArgList)NULL, 0);
-
- n=0;
- XtSetArg(args[n], GLwNrgba, TRUE); n++;
- XtSetArg(args[n], GLwNdoublebuffer, TRUE); n++;
- XtSetArg(args[n], GLwNredSize, Color_Buffer_Size); n++;
- XtSetArg(args[n], GLwNgreenSize, Color_Buffer_Size); n++;
- XtSetArg(args[n], GLwNblueSize, Color_Buffer_Size); n++;
- XtSetArg(args[n], GLwCDepthSize, Depth_Buffer_Size); n++;
-
- glw = XtCreateWidget("boiler", glwMDrawingAreaWidgetClass,
- toplevel, args, n);
-
- XtAddCallback(glw, GLwNginitCallback, initCB, &glw_context);
- XtAddCallback(glw, GLwNexposeCallback, exposeCB, &glw_context);
- XtAddCallback(glw, GLwNresizeCallback, resizeCB, &glw_context);
- XtManageChild(glw);
-
- XtRealizeWidget(toplevel);
- XtAppMainLoop(application_context);
- }
-
- void
- initCB(Widget w, XtPointer client_data, XtPointer call_data)
- {
- Display *display = XtDisplay(w);
- int screen = DefaultScreen(display);
- Window window = XtWindow(w);
- XVisualInfo *vi;
- GLXContext *glw_context = (GLXContext *) client_data;
- Arg args[10];
-
- XtSetArg(args[0], GLwNvisualInfo, &vi);
- XtGetValues(w, args, 1);
-
- *glw_context = glXCreateContext(display, vi, None, GL_TRUE);
- glXMakeCurrent(display, window, *glw_context);
-
- glClearColor(0.0, 0.0, 0.0, 1.0);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- glXSwapBuffers(display, window);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
-
- }
-
- void
- exposeCB(Widget w, XtPointer client_data, XtPointer call_data)
- {
- Display *display = XtDisplay(w);
- Window window = XtWindow(w);
- GLXContext *glw_context = (GLXContext *) client_data;
-
- glXMakeCurrent(display, window, *glw_context);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- glXSwapBuffers(display, window);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
-
- }
-
- void
- resizeCB(Widget w, XtPointer client_data, XtPointer call_data)
- {
- Display *display = XtDisplay(w);
- Window window = XtWindow(w);
- GLXContext *glw_context = (GLXContext *) client_data;
-
- glXMakeCurrent(display, window, *glw_context);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- glXSwapBuffers(display, window);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- }
-